﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Input;
using GJReminder.Utils;

using Google.GData.Calendar;

namespace GJReminder.ViewModel.Command
{
    class GetEventsCommand : ICommand
    {
        private ViewModel.ConsoleViewModel m_consoleViewModel;

        public GetEventsCommand(ViewModel.ConsoleViewModel consoleViewModel)
        {
            m_consoleViewModel = consoleViewModel;
        }

        #region ICommand Members

        bool ICommand.CanExecute(object parameter)
        {
            throw new NotImplementedException();
        }

        event EventHandler ICommand.CanExecuteChanged
        {
            add { throw new NotImplementedException(); }
            remove { throw new NotImplementedException(); }
        }

        void ICommand.Execute(object parameter)
        {
            var wrappedEntryList = App.SecurityContext.Service.Query(DateTime.Now.AddMonths(-6), DateTime.Now.AddYears(1)).WrapEntry();
            m_consoleViewModel.EventListModel.EntryList = wrappedEntryList;
        }

        #endregion
    }
}
